# -*- coding: utf-8 -*-
"""13_09_2023_7potok.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1t6p-Y1HSOUCQL9beete0sFmtggTCmHmQ
"""

from genericpath import isdir
# Задача 3
#Получить абсолютные пути всех файлов и папок в текущей
#директории.
#2. Написать рекурсивную функцию.
#3. Использовать библиотеку os

import os

def get_paths(path = '.'):
  for name in os.listdir(path):
    abs_path = os.path.abspath(os.path.join(path,name))
    yield abs_path
    if os.path.isdir(abs_path) is True:
      yield from get_paths(abs_path)



for i in get_paths('testfolder'):
  print(i)

def get_paths(path = '.'):
  for name in os.listdir(path):
    abs_path = os.path.abspath(os.path.join(path,name))
    if os.path.isfile(abs_path) is True:
      yield abs_path
    elif os.path.isdir(abs_path) is True:
      yield from get_paths(abs_path)


for i in get_paths('testfolder'):
  print(i)